package DesignPatern.A10_责任链模式.QSB.A02_责任链模式;

import java.util.ArrayList;

/**
 * @Author: Du
 * @Date: 2021/7/30 10:06
 */
public class A01_Main
{
    public static void main(String[] args)
    {
        ArrayList<IWomen> list = new ArrayList<>();
        //即使只是向儿子请求，也是按照责任链模式，先从父亲传向丈夫，再传向儿子
        list.add(new Women(3, "我要去逛街"));
        
        Handler father = new Father();
        Handler husband = new Husband();
        Handler son = new Son();
        
        father.setNext(husband);
        husband.setNext(son);
        
        for (IWomen women : list)
        {
            father.HandleMessage(women);
        }
    }
}
